#include "process/missionlist.h"

MissionList::MissionList(const QStringList *script) : QList<Mission>()
{
  for (QString l : *script) {
    if (! l.startsWith("#"))
      this->append(Mission(&l));
  }
}

int MissionList::howManyWaiting() const
{
  int i = 0;
  for (Mission m : *this) {
    if (m.status == Mission::WAITING)
      i++;
  }
  return i;
}


Mission * MissionList::nextWaiting()
{
  Mission *result = nullptr;
  MissionList::iterator i;
  for (i = this->begin(); i != this->end(); ++i) {
    if ((*i).status == Mission::WAITING) {
      result = &(*i);
      break;
    }
  }
  return result;
}
